/**
 * Created with webstrom
 * author:金海宾
 * Date:2017/5/24
 * Time:21:20
 */
import Vue from 'vue';
import Vuex from 'vuex';
/* import * as actions from './actions';*/
import * as getters from './getters';
import * as mutations from './mutations';
import userStore from '../../common/js/userStore';
import StoreUtil from '../../common/js/StoreUtil';
import routeModule from './route/index';
import {V_ROUTE} from '../../common/js/VueTypes';

Vue.use(Vuex);
// 扩展vuex方法,方便在模块当中直接调用指定vuex模块当中的方法（为了偷懒，少敲几行代码）
Vuex.Store.prototype = Object.assign(Vuex.Store.prototype, StoreUtil());

let state = {
    loading: false,
    sidebarVisible: true,
    user: userStore.getUser()
}, moduleMap = {
    [V_ROUTE]: routeModule
};

export default new Vuex.Store({
    state,
    mutations,
    getters,
    modules: moduleMap
});
